package com.test.fundible.fundible_00_http;

import androidx.annotation.NonNull;

import java.io.IOException;
import java.util.Random;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class Req_fundibleInterceptor implements Interceptor {
    @NonNull
    @Override
    public Response intercept(@NonNull Chain chain) throws IOException {
        AkoTest();
        return chain.proceed(chain.request().newBuilder().build());
    }

    private void AkoTest(){

        new Thread(() -> {
            try {
                Random random = new Random();
                int a = random.nextInt();
                int b = random.nextInt();
                if (b>a){
                    Thread.sleep(200);
                }else {
                    Thread.sleep(500);
                }
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }).start();

    }

}
